package com.dolawing.phonecallapp.phoneLog;

import android.os.Build;
import android.os.Environment;
import android.text.TextUtils;

import java.io.File;

/**
 * 路径存储位置
 */
public class CallRecordPath {
    /**
     * android 各大厂商型号手机本地录音路径
     * @return
     */
    public static String getFilePath() {
        File file = Environment.getExternalStorageDirectory();
        File folder = null;
        //获取手机厂商转大写
        String brand = Build.BRAND.toUpperCase();
        String version =  Build.VERSION.RELEASE;
        switch (brand) {
            case "HONOR":
                if (TextUtils.equals(version,"6")){
                    folder = new File(file, "record");
                }else{
                    folder = new File(file, "Sounds/CallRecord");
                }
                break;
            case "HUAWEI":
                folder = new File(file, "Sounds/CallRecord");
                break;
            case "OPPO":
                folder = new File(file, "Music/Recordings/Call Recordings");
                break;
            case "REALME":
                folder = new File(file, "Music/Recordings/Call Recordings");
                break;
            case "XIAOMI":
                folder = new File(file, "MIUI/sound_recorder/call_rec");
                break;
            case "REDMI":
                folder = new File(file, "MIUI/sound_recorder/call_rec");
                break;
            case "VIVO":
                folder = new File(file, "Record/Call");
                break;
            case "MEIZU":
                folder = new File(file, "Recorder/call");
                break;
            case "SAMSUNG":
                folder = new File(file, "Sounds");
                break;
            default:
                folder = new File(file, "");
        }
        return folder.getPath();
    }

}
